<extend name="Public:base" />
<block name="content">
<style type="text/css">
.databox.databox-vertical.databox-xlg.databox-halved .databox-bottom{
    height: 80px;
}
.databox.databox-vertical.databox-xlg{
    height: 180px;
}
.appicon{
    cursor: pointer;
    height: 75px;
    width: 75px;
    /*margin-left: -120px;*/
    position: absolute;
    z-index: 100;
    top: 200px;
    left: 96px;
}
.thumbnail{
    margin-bottom: 0px;
}
.thumbnail img{
    cursor: pointer;
}
.widget-body{
    min-height: 388px;
}    
.dl-box{
    min-height: 355px;
}
</style>

<div class="col-md-12">
    <div class="alert alert-info fade in">
        <i class="fa-fw fa fa-info"></i>
        点击封面图片或者图标可更换。
    </div>
</div>
<volist name="apps" id="ap">
<Widget:show bdcls="no-padding" col="3" title="{$ap.name}">
    <div class="dl-box">
    <div class="thumbnail">
        <img data-id="{$ap.id}" class="picurl" app-picurl src="{$ap.picurl}" class="img-responsive" >
    </div>

    <notempty name="ap[icon]">
    <img data-id="{$ap.id}" src="{$ap.icon}" class="appicon">
    <else/>
    <img data-id="{$ap.id}" src="assets/def_app.png" class="appicon">
    </notempty>

    </div>
    <div class="btn-group btn-group-justified">
        <a class="btn btn-primary " href="{:U("Page/index?apid=$ap[id]")}">页面</a>
        <a class="btn btn-primary " href="{:U("Content/index?apid=$ap[id]")}">内容</a>
        <a class="btn btn-primary " href="{:U("ApiColud/publish?apid=$ap[id]")}">发布</a>
    </div>
</Widget:show>
</volist>
<script type="text/javascript">
var pk = '0';
var t = 'icon'
function fileMangerCall(f){
    var url = "{:U('Apps/updateField')}";
    $.getJSON(url,{apid:pk,value:f,name:t,pk:pk},function(){
        if (t == 'icon') {
            $('.appicon[data-id='+pk+']').attr('src',f);
        }else if(t == 'picurl'){
            $('.picurl[data-id='+pk+']').attr('src',f);
        }
    })
}
$(function(){
    $('.appicon').on('click',function(){
        t = 'icon';
        pk = $(this).data('id');
        BootstrapDialog.show({
            message: $('<div></div>').load('user.php?c=FileManger&apid='+pk),
            title:'文件管理',
            size:'size-wide',
        });
    })

    $('[app-picurl]').on('click',function(){
        pk = $(this).data('id');
        t = 'picurl';
        BootstrapDialog.show({
            message: $('<div></div>').load('user.php?c=FileManger&t=picurl&apid='+pk),
            title:'文件管理',
            size:'size-wide',
        });
    })

    
})    
</script>

</block>
